package com.orange.delivery.presentation.common;

import org.apache.wicket.Application;
import org.apache.wicket.markup.head.CssHeaderItem;
import org.apache.wicket.markup.head.IHeaderResponse;
import org.apache.wicket.markup.html.WebPage;
import org.apache.wicket.request.resource.CssResourceReference;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import com.francetelecom.clara.component.wicket.app.utils.OrangeUtilities;

/**
 * Template for all application pages.
 */
public abstract class ApplicationTemplatePage extends WebPage {

	private static final long serialVersionUID = 1L;
	private static final Logger LOG = LoggerFactory.getLogger(ApplicationTemplatePage.class.getName());

	public ApplicationTemplatePage() {
		LOG.debug("create components for Application");
	}

	// append resources (css) to enable versioning and merging the css in
	// deployment mode
	// see the pom.xml
	@Override
	public void renderHead(IHeaderResponse response) {

		response.render(CssHeaderItem.forReference(OrangeUtilities.getResetAndGeneralOrangeStyleSheet()));

		// In development mode : use orange-main.css
		// In deployment mode : wicket automatically uses orange-main.min.css
		// (generated via maven plugin minify)

		response.render(CssHeaderItem.forReference(new CssResourceReference(Application.class, "orange-main.css")));

		super.renderHead(response);
	}
}
